package com.zliblike_platform.vo;

import lombok.Data;

/**
 * 统一接口返回结果
 */
@Data
public class ResponseResult<T> {
    private Integer status;    // 状态码
    private String message;    // 状态消息
    private T data;            // 响应数据
    
    public static <T> ResponseResult<T> success(T data) {
        ResponseResult<T> result = new ResponseResult<>();
        result.setStatus(200);
        result.setMessage("操作成功");
        result.setData(data);
        return result;
    }
    
    public static <T> ResponseResult<T> success(String message, T data) {
        ResponseResult<T> result = new ResponseResult<>();
        result.setStatus(200);
        result.setMessage(message);
        result.setData(data);
        return result;
    }
    
    /**
     * 无数据的成功响应
     * @return 响应结果
     */
    public static <T> ResponseResult<T> success() {
        ResponseResult<T> result = new ResponseResult<>();
        result.setStatus(200);
        result.setMessage("操作成功");
        return result;
    }
    
    public static <T> ResponseResult<T> fail(Integer status, String message) {
        ResponseResult<T> result = new ResponseResult<>();
        result.setStatus(status);
        result.setMessage(message);
        return result;
    }
} 